package com.example.demo.controller;

import com.example.demo.entity.JsonResult;
import com.example.demo.entity.Result;
import com.example.demo.entity.UpdateInfo;
import com.example.demo.service.AndroidService;
import com.example.demo.util.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "/Android")
public class AndroidController {

    @Autowired
    private AndroidService androidService;

    @GetMapping(value = "checkVersion")
    public JsonResult checkAndroid(@RequestParam Integer versionCode){
        JsonResult json = new JsonResult();
        UpdateInfo updateInfo =androidService.getCheckAndroidVersion(versionCode);
        json.setSuccess(true);
        json.setData(updateInfo);
        json.setMessage("success");
        return json;
    }
}
